/**
 * @file hdl_rng.c
 * @author your name (you@domain.com)
 * @brief
 * @version 0.1
 * @date 2025-01-13
 *
 * @copyright Copyright (c) 2025
 *
 */


/* includes ----------------------------------------------------------*/
#include "hdl_rng.h"
/* typedef -----------------------------------------------------------*/
/* define ------------------------------------------------------------*/
/* variables ---------------------------------------------------------*/
/* function prototypes -----------------------------------------------*/

/**
 * @brief
 *
 */
void vhdl_rng_init(void)
{
    RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
    RNG_Cmd(ENABLE);
    while (RNG_GetFlagStatus(RNG_FLAG_DRDY) == RESET) {}
}

/**
 * @brief
 *
 * @return uint32_t
 */
uint32_t _u32hdl_read_rng(void)
{
    uint32_t randomNumber;
    while (RNG_GetFlagStatus(RNG_FLAG_DRDY) == RESET) {}
    randomNumber = RNG_GetRandomNumber();
    return (randomNumber);
}
